package OJPractice;

import java.util.*;

public class text {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while (scan.hasNextLine()) {
            String str = scan.nextLine();
            String[] strs = str.split(",");
            int y = Integer.parseInt(strs[0]);
            int m = Integer.parseInt(strs[1]);
            int d = Integer.parseInt(strs[2]);
            int[] day = {31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365};
            // 如果是闰年就在 + 1
            int sum  = 0;
            if (m > 2) {
                sum += day[m-2];
            }
            sum += d;
            // 判断是否是闰年
            if (((y % 400 == 0) || (y % 4 == 0 && y % 100 != 0)) && m > 2) {
                sum += 1;
            }
            System.out.println(sum);

        }
    }
}
